package com.zhubayi.service.impl;

import com.zhubayi.entity.Category;
import com.zhubayi.mapper.CategoryMapper;
import com.zhubayi.service.CategoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author 祝八一
 */
@Service
public class CategoryServiceImpl implements CategoryService {
    @Autowired
    private CategoryMapper categoryMapper;
    @Override
    public void add(String name) {
        categoryMapper.add(name);
    }

    @Override
    public List<Category> queryAll() {
        return categoryMapper.queryAll();
    }

    @Override
    public Category queryById(Integer id) {
        return categoryMapper.queryById(id);
    }

    @Override
    public void del(Integer id) {
        categoryMapper.delById(id);
    }

    @Override
    public void update(int parseInt, String name) {
        categoryMapper.update(parseInt, name);
    }

    @Override
    public List<Category> queryByName(String name) {
        return categoryMapper.queryByName(name);
    }
}
